import { defineStore } from 'pinia';
import { ref } from 'vue';

export const useExamStore = defineStore('exam', () => {
  // 定义状态相关的内容
  const currentExam = ref({}); // 存储当前选中的考试数据

  // 设置当前选中的考试数据
  const setCurrentExam = (exam) => {
    currentExam.value = exam;
  };

  // 清空当前选中的考试数据
  const clearCurrentExam = () => {
    currentExam.value = {};
  };

  return { currentExam, setCurrentExam, clearCurrentExam };
}, { persist: { storage: sessionStorage } }); // 启用持久化